<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>修改企业分店</title>
<%@include file="../collect/meta.jsp"%>
<style type="text/css">
.tbinput {
	width: 180px;
	height: 28px;
	font-size: 15px;
	background-color: #FFFFCC
}
</style>
<link rel="stylesheet" href="css/radius.css" type="text/css"></link>
<link rel="stylesheet" href="css/Inputstyle.css" type="text/css"></link>
<link rel="stylesheet" href="css/muser.css" type="text/css"></link>
<script type="text/javascript" src="${ctx}/js/returnTop.js"></script>
</head>
<body lang="zh-cn">
	<div class="wrapper">
		<c:import url="/collect/top.jsp"></c:import>
		<div class="main-container" id="main-container">
			<div class="main-container-inner">
				<c:import url="/collect/left.jsp"></c:import>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<ul class="breadcrumb">
							<li><i class="icon-home home-icon"></i>分店管理</li>
							<li><a href="muser!getAllUser">分店管理账号</a>
							</li>
							<li>修改管理账号</li>
						</ul>
						<!-- .breadcrumb -->
					</div>
					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								<form action="muser!updateUser" name="updateuser" method="post">
									<div align="center">
										<div class="common">
											<label for="two">登陆账号:&nbsp;</label> <input type="text"
												class="input" id="two" name="user.mobile"
												value="${user.mobile}" maxlength="11" />
										</div>
										<div class="common">
											<label for="two">&nbsp;&nbsp;&nbsp;&nbsp;姓名:&nbsp;</label> <input type="text"
												class="input" id="two" name="user.userName"
												value="${user.userName}" maxlength="11" />
										</div>
										<div class="common">
											<label for="">所属店铺:&nbsp;</label> <select name="user.shopId">
												<c:forEach items="${shops}" var="shop">
													<option value="${shop.id }"
														<c:if test="${user.shopId == shop.id }">selected='selected'</c:if>>${shop.name
														}</option>
												</c:forEach>
											</select>
										</div>
										<input type="hidden" name="user.id" id="userId"
											value="${user.id }" />
										<div id="btn-team">
											<input type="button" class="btn btn-primary radius" id="but"
												value="确定" /> <a class="btn btn-primary class radius"
												href="muser!getAllUser">返回</a>
										</div>
										<input type="hidden" name="user.createTime"
											value="${user.createTime }" /> <font
											style="color: red; font-size: 25px;">${result }</font>
									</div>
								</form>
								<!-- PAGE CONTENT ENDS -->
							</div>
							<!-- /.col -->
						</div>
						<!-- /.row -->
					</div>
					<!-- /.page-content -->
				</div>
				<!-- /.main-content -->
			</div>
			<!-- /.main-container-inner -->
			<a href="#" id="btn-scroll-up"
				class="btn-scroll-up btn btn-sm btn-inverse"
				style="position:fixed;bottom:0;"> <i
				class="icon-double-angle-up icon-only bigger-110"></i> </a>
		</div>
		<!-- /.main-container -->
		<div class="push"></div>
	</div>
	<c:import url="/collect/down.jsp"></c:import>

	<script type="text/javascript">
		$(document)
				.ready(
						function() {
							var sub2 = true;

							function checkMobile() {
								var mobile = $("input[id='two']").val();
								if (mobile.length == 0) {
									$("div[id='two']").html("");
									$("div[id='two']").html(
											"<font color='red'>请输入登陆账号</font>");
									sub2 = false;
									return false;
								} else {
									$("div[id='two']").html("");
									sub2 = true;
								}

								$
										.ajax({
											async : false,
											url : "muser!checkUpdateMessage",
											type : "post",
											data : {
												"userMobile" : mobile,
												"userId" : $("#userId").val()
											},
											datatype : "json",
											success : function(data) {

												var d = eval("(" + data + ")");

												var b = d.check;
												if (!b) {
													$("div[id='two']").html("");
													$("div[id='two']")
															.html(
																	"<font color='red'>登陆账号已被注册</font>");
													sub2 = false;
												} else {
													$("div[id='two']").html("");
													sub2 = true;
												}
											},
											error : function(request) {
												alert("Connection error");
											}
										});
							}

							$("#but").click(
									function() {
										var shopId = $(
												"select[name='user.shopId']")
												.val();
										if (shopId == null || shopId == '') {
											alert("请您先创建分店！");
											return false;
										}

										checkMobile();

										if (sub2) {
											updateuser.submit();
										} else {
											return false;
										}
									});
						});

		$(document).ready(function() {
			$('.fendianguanli > ul').show();
			$('.fendianguanli > ul > li > a').eq(1).css("color", "red");
		});
	</script>
</body>
</html>